#-*- encoding:utf-8 -*-
'''
Created on 2011-4-16

@author: byy
'''
import pysvn
import subprocess
import os

svnhome = r'F:\svn-client'
csvFile = 'F:\\svn-client\\tx2数据\\剧情故事\\导入数据\\飞行.csv'
workdir = r'F:\svn-client\tx2数据\剧情故事\导入数据'
#print 'workdir:',isinstance(workdir,str),workdir
os.environ['PATH'] += r'F:\Subversion\bin;'
#print os.environ['PATH']

os.chdir(u'F:\\svn-client\\tx2数据\\剧情故事\\导入数据')
#print os.getcwdu()
cmd = r'svn diff -r 1 ' +u'飞行.csv'.decode('utf-8').encode('gbk')
p = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
for line in p.stdout.readlines():
    print line.decode('gbk').encode('utf-8'),
'''
client = pysvn.Client()
entry = client.info(r'F:\svn-client')
print 'Url:',entry.url
csvFile = u'F:\\svn-client\\tx2数据\\剧情故事\\导入数据\\飞行.csv'
file_content = client.cat(csvFile)
print file_content.decode('gbk').encode('utf-8')
revision1 = pysvn.Revision(pysvn.opt_revision_kind.base)
revision2 = pysvn.Revision(pysvn.opt_revision_kind.working)
print revision1,revision2,revision1 == revision2
diff_text = client.diff(u'F:\\svn-client\\tx2数据\\剧情故事\\导入数据\\',u'F:\\svn-client\\tx2数据\\剧情故事\\导入数据\\飞行.csv')
print 'diff_text=',diff_text

for i in client.list(u'F:\\svn-client\\tx2数据\\剧情故事\\导入数据\\'):
    for r in i:
        print type(r)
'''